<template>
  <div class="comment-list">
    <div class="comment-title">评论列表</div>
    <div class="comment" v-for="(comment,i) in comments" :key="i" @click='handleclick(comment.bookid)'>
      <div class="flex-box">
        <div class="user"><img class="user-head" :src="comment.user_info.image" mode="aspectFit">{{comment.nickName}}</div>
      <div class="right text-primary">
        {{comment.location || '未知地点'}}---{{comment.phone || '未知机型'}}
      </div>
      </div>
      <div class="content">{{comment.comment}}</div>
    </div>
  </div>
</template>
<script>
export default {
  props: ['comments', 'type'],
  methods: {
    handleclick (id) {
      if (this.type === 'user') {
        wx.navigateTo({
          url: '/pages/detail/main?id=' + id
        })
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.comment-list{
  background-color: #eee;
  font-size: 14px;
  .flex-box{
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .comment{
    margin-bottom: 10rpx;
    padding:10rpx;
    background-color: #fff;
    margin: 5rpx 0;
   }
  .user-head{
      width: 60rpx;
      height: 60rpx;
      border-radius: 50%;
    }
}
</style>

